/*
 * 
 * Copyright 2006 POB-Technology. All rights reserved.
 * POB-Technology PROPRIETARY/CONFIDENTIAL.
 * 
 */

using System;
using System.IO.Ports ;

namespace RgbComponent
{
	/// <summary>
	/// Serial Communication class.
	/// </summary>
	public class Serial : SerialPort, Communication
	{
		byte []temp = new byte[1] ;
		
		public Serial(string portname, int baud, int data)
		{
			PortName = portname ;
			BaudRate = baud ;
        	Parity = Parity.None;
        	DataBits = data ;
        	StopBits = StopBits.One ;
        	Handshake = Handshake.None ;

        	// Set the read/write timeouts
        	ReadTimeout = 1000;
        	WriteTimeout = 1000;
		}
			
		public void WriteByte(byte Byte)
		{
			temp[0] = Byte ;
			
			Write(temp,1);
		}
		
		public int Read(byte []buffer, int count)
		{
			return Read(buffer,0,count);
		}
		
		public void Write(byte []buffer, int len)
		{
			Write(buffer,0,len);
		}		
		
	}
}

